package com.hzit.loan.manager.service;

import com.hzit.loan.manager.annon.TargetDataSource;
import com.hzit.loan.manager.mapper.MchInfoMapper;
import com.hzit.loan.manager.mapper.UserInfoMapper;
import com.hzit.loan.manager.mapper.XxlJobUserMapper;
import com.hzit.loan.manager.model.MchInfo;
import com.hzit.loan.manager.model.XxlJobUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class TestService {

    @Autowired
    private XxlJobUserMapper jobUserMapper;

    @Autowired
    private MchInfoMapper mchInfoMapper;

    @Autowired
    private UserInfoMapper userInfoMapper;

    //操作xxl_job 数据库
    @TargetDataSource(name = "ds1")
    public String  queryXxlJob(){

        XxlJobUser xxlJobUser = jobUserMapper.selectByPrimaryKey(1);

        return xxlJobUser.getUsername();

    }

    //操作pay-web
    public String  queryPayWeb(){

        MchInfo mchInfo = mchInfoMapper.selectByPrimaryKey("1000");

        return mchInfo.getMchName();

    }

    //操作pay-web
    @TargetDataSource(name = "ds2")
    public String  queryUser(){


        return userInfoMapper.selectByPrimaryKey(1).getUserName();
//
    }

}
